home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000057_icon-group-sender_Thu Mar 27 17:16:15 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2S0GEo08046
  4.     for icon-group-addresses; Thu, 27 Mar 2003 17:16:14 -0700 (MST)
  5. Message-Id: <200303280016.h2S0GEo08046@baskerville.CS.Arizona.EDU>
  6. From: voice_of_reason@australia.edu (Quiet Voice)
  7. X-Newsgroups: comp.lang.icon
  8. Subject: Re: newbie questions -- ressurected
  9. Date: 27 Mar 2003 14:00:50 -0800
  10. X-Complaints-To: groups-abuse@google.com
  11. To: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. "Steve Wampler" <swampler@noao.edu> wrote in message news:<pan.2003.03.26.15.06.49.245949@noao.edu>...
  16. > Tables are, by definition, unordered, so you can't reorganize
  17. > the table.  But if you're writing the keys and values of a table
  18. > out, you probably shouldn't care - the output is really just
  19. > bytes in a file, not an Icon structure.  If you want an order
  20. > imposed on the keys and values in a table, you will need to
  21. > place those keys and values into a list [which is what the
  22. > sort function does for you when given a table].
  23. > I'm confused by the statement saying 'data' is an external
  24. > file - are you expecting the sort function to reconstruct
  25. > a table from that files contents automatically?
  26.  
  27. Hi,
  28.  
  29. Thanks for you reply.
  30.  
  31. With the assistance of several others who wrote to me directly via
  32. e:mail, I was able to solve this problem.
  33.  
  34. The correct code is as follows:
  35.  
  36. every lettercount := !sort(lettercount,2) do
  37. write(outputfile,lettercount[1]," -- ",lettercount[2])
  38.  
  39. The one problem is that this sorts it in ascending order. Can't recall
  40. if there is a direct function to sort decending...but that's a minor
  41. concern right now.
  42.  
  43. Again, thank you.
  44.